package org.egrit;

import java.awt.Point;

/**
 * Defines methods for iterators that return a sequence of grid cell positions.
 *
 * @author michael
 */
public interface IGridIterator {
    
    /**
     * Gets the bounds for this iterator. Note that some iterator classes
     * may only operate on a (possibly small or empty) subset of cells within 
     * the returned bounds. In other words, all that is guaranteed is that the
     * iterator will not return any cells outside these bounds.
     */
    IGridBounds getGridBounds();

    /**
     * Gets the current iterator position.
     *
     * @return current position
     */
    Point getPos();

    /**
     * Tests if the iterator can be advanced.
     *
     * @return {@code true} if the iterator can be advanced
     */
    boolean hasNext();

    /**
     * Advances the iterator if possible.
     *
     * @return {@code true} if the iterator was advanced
     */
    boolean next();
    
    /**
     * Tests whether this iterator is empty at creation, ie. had no
     * cell positions to return.
     * 
     * @return true if the iterator is empty
     */
    boolean isEmpty();
    
    /**
     * Resets the iterator to its starting position.
     */
    void reset();

}
